Will a Customer Accept the Coupon?

Overview

The goal of this project is to use what you know about visualizations and probability distributions to distinguish between customers who accepted a driving coupon versus those that did not.

Data

This data comes to us from the UCI Machine Learning repository and was collected via a survey on Amazon Mechanical Turk. The survey describes different driving scenarios including the destination, current time, weather, passenger, etc., and then ask the person whether he will accept the coupon if he is the driver. Answers that the user will drive there ‘right away’ or ‘later before the coupon expires’ are labeled as ‘Y = 1’ and answers ‘no, I do not want the coupon’ are labeled as ‘Y = 0’. There are five different types of coupons -- less expensive restaurants (under \$20), coffee houses, carry out & take away, bar, and more expensive restaurants (\\$20 - \$50).

Deliverables

Your final product should be a brief report that highlights the differences between customers who did and did not accept the coupons. To explore the data you will utilize your knowledge of plotting, statistical summaries, and visualization using Python. You will publish your findings in a public facing github repository as your first portfolio piece.

Data Description

The attributes of this data set include:

  1. User attributes

    • Gender: male, female
    • Age: below 21, 21 to 25, 26 to 30, etc.
    • Marital Status: single, married partner, unmarried partner, or widowed
    • Number of children: 0, 1, or more than 1
    • Education: high school, bachelors degree, associates degree, or graduate degree
    • Occupation: architecture & engineering, business & financial, etc.
    • Annual income: less than \$12500, \\$12500 - \$24999, \\$25000 - \$37499, etc.
    • Number of times that he/she goes to a bar: 0, less than 1, 1 to 3, 4 to 8 or greater than 8
    • Number of times that he/she buys takeaway food: 0, less than 1, 1 to 3, 4 to 8 or greater than 8
    • Number of times that he/she goes to a coffee house: 0, less than 1, 1 to 3, 4 to 8 or greater than 8
    • Number of times that he/she eats at a restaurant with average expense less than \$20 per person: 0, less than 1, 1 to 3, 4 to 8 or greater than 8
    • Number of times that he/she goes to a bar: 0, less than 1, 1 to 3, 4 to 8 or greater than 8
  2. Contextual attributes

    • Driving destination: home, work, or no urgent destination
    • Location of user, coupon and destination: we provide a map to show the geographical location of the user, destination, and the venue, and we mark the distance between each two places with time of driving. The user can see whether the venue is in the same direction as the destination.
    • Weather: sunny, rainy, or snowy
    • Temperature: 30F, 55F, or 80F
    • Time: 10AM, 2PM, or 6PM
    • Passenger: alone, partner, kid(s), or friend(s)
  3. Coupon attributes

    • time before it expires: 2 hours or one day

Problems

Use the prompts below to get started with your data analysis.

  1. Read in the coupons.csv file.
  1. Investigate the dataset for missing or problematic data.
  1. Decide what to do about your missing data -- drop, replace, other...
  1. What proportion of the total observations chose to accept the coupon?
  1. Use a bar plot to visualize the coupon column.
  1. Use a histogram to visualize the temperature column.

Investigating the Bar Coupons

Now, we will lead you through an exploration of just the bar related coupons.

  1. Create a new DataFrame that contains just the bar coupons.
  1. What proportion of bar coupons were accepted?
  1. Compare the acceptance rate between those who went to a bar 3 or fewer times a month to those who went more.
  1. Compare the acceptance rate between drivers who go to a bar more than once a month and are over the age of 25 to the all others. Is there a difference?
  1. Construct a null and alternative hypothesis for the difference between groups of drivers who go to a bar more than once a month and are over the age of 25 to all other drivers.
Analysis:

The above chart confirms that younger drivers (under 25) go to bars more often than the other groups. But, when it comes to the bar coupon acceptance rate, driver of age over 25 tends to accept more bar coupons than their younger counterparts. Though the chart trend goes down between ages 30 and under 50, the trend picks back up with older people (over age 50) as they frequent bars and accept more bar coupons.

  1. Using alpha at 0.05 test your hypothesis and state your conclusion.
Analysis:

The above chart confirms that the younger drivers (under 25) goes to bar often. But the combined age group 25-30 goes to bar more often than younger drivers. The bar going trend swindles down as the population goes older but picks back up with driversof age above 50.

  1. Use the same process to compare the acceptance rate between drivers who go to bars more than once a month and had passengers that were not a kid and had occupations other than farming, fishing, or forestry.
  1. Compare the acceptance rates between those passengers who:
  1. Based on these observations, what do you hypothesize about passengers who accepted the bar coupons?

Alternative Hypothesis

Though younger drivers tend to go to bars more often, only those who are between 26 and 27 ages tend to accept more bar coupons than all other groups. The bar-goers accept only about 18.9% of cheap restaurant coupons and an income below $50K doesn’t influence the acceptance of the cheap restaurant coupons.

Independent Investigation

Using the bar coupon example as motivation, you are to explore one of the other coupon groups and try to determine the characteristics of passengers who accept the coupons.

Analysis of coffee house coupon acceptance rate for those visited atleast once a month and over age 25

Analysis:

The above chart confirms that younger people (under 25 age) go to bars more often than people of age over 25. But the chart also sheds the light that the younger drivers accept more coffee house coupons than others. Though the coupon acceptance trend goes down as the population gets older, it trends back up with older people (over age 50) who frequent coffee houses and accepts more coffee house coupons.

Histogram charts to show coffee house coupon acceptance by Marital Status, Income, Education and Gender

Analysis:

Single drivers accept more coffee house coupons followed by married partner drivers. Drivers with widowed marital status drivers visit and accept fewer coffee houses and coupons.

Analysis:

Drivers making income between less than $12.5K and $50K tends to accept more coffee house coupons. For those making income between $51K and $99K tends to accept less coffee house coupons. But, the trend switches back for those who makes an income $100K or more to accept more coffee house coupons.

Analysis:

Drivers with no college degree accepted more coffee house coupons than others. People in high school tend to visit and accept fewer coffee houses and coupons.

Analysis:

Female drivers tend to go to coffee houses more than male drivers. Though the female drivers tend to reject more coffee house coupons, they still have a high coupon acceptance rate when compared to their male counterparts.